<?php

namespace app\site\service\site;

use app\model\site\DiyPage;
use app\site\service\SiteBaseService;
use app\site\service\traits\InstanceTrait;
use think\db\Query;

class DiyPageService extends SiteBaseService
{

    use InstanceTrait;

    public function initialize()
    {
        $this->model = new DiyPage();
    }

    function formatData(array $data): array
    {
        $data['content'] = serialize($data['content']);

        return $data;
    }


    public function query(): Query
    {
        return $this->makeQuery()->filter(function ($v) {
            $v->content = miUnserialize($v->content);
        });
    }



}
